//
//  GToastSuccess.swift
//  GOFM
//
//  Created by siri on 2024/1/25.
//  Copyright © 2024 Glad. All rights reserved.
//

import SwiftUI

struct GToastSuccess: View{
    
    @Binding var isShowing: Bool
    @Binding var text: String
 
    
    var body: some View {
            ZStack {
                
                VStack {

                        Image(systemName: "checkmark")
                            .resizable()
                            .frame(width: 40, height: 30)
                            .padding(.top, 20)
                            .padding(.bottom, 20)
                            
                        Text(self.text)
                            .padding(.top, -8)
                            .padding(.bottom, 16)
                    
                }
                .frame(minWidth: 120,
                       idealWidth: nil,
                       maxWidth: nil,
                       minHeight: 120,
                       idealHeight: nil,
                       maxHeight: nil,
                       alignment: .center)
                .background(Color.g_color_bg_toast)
                .foregroundColor(Color.g_color_bg_white)
                .cornerRadius(CommonStyleSet.g_radius_medium)
                .opacity(self.isShowing ? 1 : 0)
                .padding()
            }
    }
}

struct GToastSuccess_Previews: PreviewProvider {
    static var previews: some View {
        GToastSuccess(isShowing: .constant(true), text: .constant("成功类文案"))
    }
}

